<template>
  <div id='app'>

      <form action="/">
  <van-search
    v-model="value"
    show-action
    placeholder="请输入搜索关键词"
    @cancel="onCancel"
  />
</form>
    
<van-card
v-for="(c,i) in list"
:key="i"
  tag="超值"
  :price="c.price"
  desc="2007年产"
  :title="c.title"
  :origin-price="c.old_price"
  :thumb="c.pic"
>
  <template #tags>
    <van-tag plain type="danger">三天无理由</van-tag>
    <van-tag plain type="danger">准手机</van-tag>
    <van-tag plain type="danger">一成购</van-tag>
  </template>
  <template #footer>
    <van-button size="mini"><van-icon name="cart-o" /></van-button>
  </template>
</van-card>
  </div>
</template>

<script>
export default {
  data () {
    return {
      list: [],
      index:this.$route.query.cp,
      value:this.$route.query.cp
    }
  },
  methods: {
      get(){
          this.$axioss.get('/list.json').then(res=>{
              console.log(res.data.result);
              this.list=res.data.result
              this.list=this.list.filter((res)=>{
                  return res.title.includes(this.index)

              })
              console.log(this.list);
          })
      },
      onCancel(){
  this.$router.push('home')

      }

  },
  mounted() {
      this.get()

  },
  components: {

  }
}
</script>

<style lang='scss'>

</style>
